Vue.component("searchuser", {
    data(){
      return {
        sval:"",
        view:""
      }
    },
    props:["path", "col", "pval"],
    template:`<div style="margin:20px;">
      <el-input v-model="sval" placeholder="UserID/昵称"></el-input>
      <el-button type="primary" plain @click="opendata(1)">查询</el-button>
      <pre>{{view}}</pre>
    </div>`,
    methods:{
      opendata:function(){ //请求数据
        let $this = this;
        if(this.view) this.view = "";
        http.get("/ajax/" + this.path + "?V=" + this.sval).then(function(res){
            $this.view = res.data.view;
        });
      },
      cellclick:function(row,col,cell){ //点击了单元格
        if(this.col[0] == "UserID" && cell.cellIndex == 0){
          console.log("UserID", cell.innerText);
          this.$emit('showmenu', 1, 1, cell.innerText);
        }
      }
    },
    created:function(){
      console.log("created ", this.pval, " sval ", this.sval);
      if(this.pval){
        this.sval = this.pval;
        this.opendata();
      }
    }
  });